package com.meizi.codegenerate.packagegenerate;

import com.meizi.codegenerate.entity.ProjectPositionEntity;
import com.meizi.codegenerate.generate.clien.domain.model.ModelGenerate;
import com.meizi.codegenerate.generate.clien.domain.repository.entity.EntityGenerate;
import com.meizi.codegenerate.generate.clien.ui.request.RequestGenerate;
import com.meizi.codegenerate.generate.clien.ui.request.query.PageParamQueryBodyGenerate;
import com.meizi.codegenerate.generate.clien.ui.response.ResponseGenerate;
import com.meizi.codegenerate.utils.PropertiesUtils;

import java.io.File;
import java.io.IOException;

/**
 * @author Administration
 * @date 2022/10/18 - 17:53 - 星期二
 * @project lambda
 * @package com.meizi.codegenerate.generate
 * @by 晨
 */
public class PackageGenerate {

    public static void main(String[] args) throws IOException {

        // 加载项目位置
        ProjectPositionEntity projectPosition = getProjectPosition();
        // 生成main
        createProject(projectPosition);
        // 生成test测试目录
        createProjectTest(projectPosition);
        // 生成resources 资源目录
        createResources(projectPosition);
        // 创建model
        createModel(projectPosition);
        // 创建Enums
        createEnums(projectPosition);
        // 创建Request 请求
        createUiRequest(projectPosition);

        createUiQuery(projectPosition);
        // 创建Response 返回
        createUiResponse(projectPosition);

        /**
         * 生成 server application 相关
         */
        createServerApplicationAssembler(projectPosition);
        // desensitizer
        createServerApplicationDesensitizer(projectPosition);
        //  impl
        createServerApplicationImpl(projectPosition);
        /**
         * 生成 server domain 相关
         */
        createServerDomainDao(projectPosition);
        // Impl
        createServerDomainImpl(projectPosition);
        //  translator
        createServerDomainTranslator(projectPosition);


        // 生成 entity 和 enum
        EntityGenerate.createEntity();
        // 生成 model
        ModelGenerate.createModel();
        // 生成 request 和 requestById
        RequestGenerate.createRequester();
        // 生成 requestQuery
        PageParamQueryBodyGenerate.createPageParamQueryBody();
        //生成 response
        ResponseGenerate.createResponse();
    }

    private static void createServerDomainTranslator(ProjectPositionEntity projectPosition) {
        // 读取文件是否存在
        StringBuilder stringBuffer = new StringBuilder(obtainServerDocumentUrl(projectPosition));
        stringBuffer
                .append(projectPosition.getServerDomain())
                .append(projectPosition.getServerDomainRepository())
                .append(projectPosition.getServerDomainRepositoryTranslator());
        System.out.println("Translator 存放路径" + stringBuffer.toString());
        File file = new File(stringBuffer.toString());
        if (!file.exists() && !file.isDirectory()) {
            // 创建文件
            System.out.println("创建 Translator 文件夹" + file.mkdirs());
        }
    }

    private static void createServerDomainImpl(ProjectPositionEntity projectPosition) {
        // 读取文件是否存在
        StringBuilder stringBuffer = new StringBuilder(obtainServerDocumentUrl(projectPosition));
        stringBuffer
                .append(projectPosition.getServerDomain())
                .append(projectPosition.getServerDomainRepository())
                .append(projectPosition.getServerDomainRepositoryImpl());
        System.out.println("impl 存放路径" + stringBuffer.toString());
        File file = new File(stringBuffer.toString());
        if (!file.exists() && !file.isDirectory()) {
            // 创建文件
            System.out.println("创建 impl 文件夹" + file.mkdirs());
        }
    }

    private static void createServerDomainDao(ProjectPositionEntity projectPosition) {
        // 读取文件是否存在
        StringBuilder stringBuffer = new StringBuilder(obtainServerDocumentUrl(projectPosition));
        stringBuffer
                .append(projectPosition.getServerDomain())
                .append(projectPosition.getServerDomainRepository())
                .append(projectPosition.getServerDomainRepositoryDao());
        System.out.println("dao 存放路径" + stringBuffer.toString());
        File file = new File(stringBuffer.toString());
        if (!file.exists() && !file.isDirectory()) {
            // 创建文件
            System.out.println("创建 dao 文件夹" + file.mkdirs());
        }
    }

    private static void createServerApplicationImpl(ProjectPositionEntity projectPosition) {
        // 读取文件是否存在
        StringBuilder stringBuffer = new StringBuilder(obtainServerDocumentUrl(projectPosition));
        stringBuffer
                .append(projectPosition.getServerApplication())
                .append(projectPosition.getServerApplicationService())
                .append(projectPosition.getServerApplicationServiceImpl());
        System.out.println("impl 存放路径" + stringBuffer.toString());
        File file = new File(stringBuffer.toString());
        if (!file.exists() && !file.isDirectory()) {
            // 创建文件
            System.out.println("创建 impl 文件夹" + file.mkdirs());
        }
    }

    private static void createServerApplicationDesensitizer(ProjectPositionEntity projectPosition) {
        // 读取文件是否存在
        StringBuilder stringBuffer = new StringBuilder(obtainServerDocumentUrl(projectPosition));
        stringBuffer
                .append(projectPosition.getServerApplication())
                .append(projectPosition.getServerApplicationService())
                .append(projectPosition.getServerApplicationServiceDesensitizer());
        System.out.println("Desensitizer 存放路径" + stringBuffer.toString());
        File file = new File(stringBuffer.toString());
        if (!file.exists() && !file.isDirectory()) {
            // 创建文件
            System.out.println("创建 Desensitizer 文件夹" + file.mkdirs());
        }
    }

    /**
     * 生成 assembler
     * @param projectPosition
     */
    private static void createServerApplicationAssembler(ProjectPositionEntity projectPosition) {
        // 读取文件是否存在
        StringBuilder stringBuffer = new StringBuilder(obtainServerDocumentUrl(projectPosition));
        stringBuffer
                .append(projectPosition.getServerApplication())
                .append(projectPosition.getServerApplicationService())
                .append(projectPosition.getServerApplicationServiceAssembler());
        System.out.println("assembler 存放路径" + stringBuffer.toString());
        File file = new File(stringBuffer.toString());
        if (!file.exists() && !file.isDirectory()) {
            // 创建文件
            System.out.println("创建 assembler 文件夹" + file.mkdirs());
        }
    }

    /**
     * 项目位置
     * @return
     */
    public static ProjectPositionEntity getProjectPosition (){
        // 加载配置文件
        PropertiesUtils properties = PropertiesUtils.getInstance("packagegenerate/config");
        // 获取对应的属性
        String projectPosition = properties.getKey("project.position");
        String projectName = properties.getKey("project.name");
        String projectSrc = properties.getKey("project.src");
        String projectTest = properties.getKey("project.test");
        String projectTestJava = properties.getKey("project.test.java");
        String projectMain = properties.getKey("project.main");
        String projectJava = properties.getKey("project.java");
        String projectResources = properties.getKey("project.resources");
        String subdomainName = properties.getKey("project.subdomainName");
        String oneLevel = properties.getKey("project.one-level");
        String twoLevel = properties.getKey("project.two-level");
        String client = properties.getKey("project.client");
        String clientApplication = properties.getKey("project.client-application");
        String clientApplicationService = properties.getKey("project.client-application-service");
        String clientApplicationServiceClient = properties.getKey("project.client-application-service-client");
        String clientApplicationServiceFallback = properties.getKey("project.client-application-service-fallback");
        String clientDomain = properties.getKey("project.client-domain");
        String clientDomainEnum = properties.getKey("project.client-domain-enum");
        String clientDomainModel = properties.getKey("project.client-domain-model");
        String clientDomainRepository = properties.getKey("project.client-domain-repository");
        String clientDomainRepositoryEntity = properties.getKey("project.client-domain-repository-entity");
        String clientUi = properties.getKey("project.client-ui");
        String clientUiRequest = properties.getKey("project.client-ui-request");
        String clientUiRequestQuery = properties.getKey("project.client-ui-request-query");
        String clientUiResponse = properties.getKey("project.client-ui-response");


        String server = properties.getKey("project.server");
        String serverApplication = properties.getKey("project.server-application");
        String serverApplicationService = properties.getKey("project.server-application-service");
        String serverApplicationServiceAssembler = properties.getKey("project.server-application-service-assembler");
        String serverApplicationServiceDesensitizer = properties.getKey("project.server-application-service-desensitizer");
        String serverApplicationServiceImpl = properties.getKey("project.server-application-service-impl");
        String serverDomain = properties.getKey("project.server-domain");
        String serverDomainRepository = properties.getKey("project.server-domain-repository");
        String serverDomainRepositoryDao = properties.getKey("project.server-domain-repository-dao");
        String serverDomainRepositoryImpl = properties.getKey("project.server-domain-repository-domain-impl");
        String serverDomainRepositoryTranslator = properties.getKey("project.server-domain-repository-translator");

        ProjectPositionEntity position = new ProjectPositionEntity();
        position.setProjectPosition(projectPosition);
        position.setProjectName(projectName);
        position.setProjectSsrc(projectSrc);
        position.setProjectMain(projectMain);
        position.setProjectTest(projectTest);
        position.setProjectJava(projectJava);
        position.setProjectSubdomainName(subdomainName);
        position.setProjectOneLevel(oneLevel);
        position.setProjectTwoLevel(twoLevel);
        position.setProjectTestJava(projectTestJava);
        position.setProjectResources(projectResources);
        position.setClient(client);
        position.setClientApplication(clientApplication);
        position.setClientApplicationService(clientApplicationService);
        position.setClientApplicationServiceClient(clientApplicationServiceClient);
        position.setClientApplicationServiceFallback(clientApplicationServiceFallback);
        position.setClientDomain(clientDomain);
        position.setClientDomainEnum(clientDomainEnum);
        position.setClientDomainModel(clientDomainModel);
        position.setClientDomainRepository(clientDomainRepository);
        position.setClientDomainRepositoryEntity(clientDomainRepositoryEntity);
        position.setClientUi(clientUi);
        position.setClientUiRequest(clientUiRequest);
        position.setClientUiRequestQuery(clientUiRequestQuery);
        position.setClientUiResponse(clientUiResponse);

        position.setServer(server);
        position.setServerApplication(serverApplication);
        position.setServerApplicationService(serverApplicationService);
        position.setServerApplicationServiceAssembler(serverApplicationServiceAssembler);
        position.setServerApplicationServiceDesensitizer(serverApplicationServiceDesensitizer);
        position.setServerApplicationServiceImpl(serverApplicationServiceImpl);
        position.setServerDomain(serverDomain);
        position.setServerDomainRepository(serverDomainRepository);
        position.setServerDomainRepositoryDao(serverDomainRepositoryDao);
        position.setServerDomainRepositoryImpl(serverDomainRepositoryImpl);
        position.setServerDomainRepositoryTranslator(serverDomainRepositoryTranslator);

        return position;
    }

    /**
     * 生成存放 query 目录
     * @param projectPosition
     */
    public static void createUiQuery(ProjectPositionEntity projectPosition) {
        // 读取文件是否存在
        StringBuilder stringBuffer = new StringBuilder(obtainDocumentUrl(projectPosition));
        stringBuffer
                .append(projectPosition.getClientUi())
                .append(projectPosition.getClientUiRequest())
                .append(projectPosition.getClientUiRequestQuery());
        System.out.println("query 存放路径" + stringBuffer.toString());
        File file = new File(stringBuffer.toString());
        if (!file.exists() && !file.isDirectory()) {
            // 创建文件
            System.out.println("创建 query 文件夹" + file.mkdirs());
        }
    }

    /**
     * 生成存放 feign 目录
     * @param projectPosition
     */
    public static void createFeign(ProjectPositionEntity projectPosition) {
        // 读取文件是否存在
        StringBuilder stringBuffer = new StringBuilder(obtainDocumentUrl(projectPosition));
        stringBuffer
                .append(projectPosition.getClientApplication())
                .append(projectPosition.getClientApplicationService())
                .append(projectPosition.getClientApplicationServiceClient());
        System.out.println("feign.client 存放路径" + stringBuffer.toString());
        File file = new File(stringBuffer.toString());
        if (!file.exists() && !file.isDirectory()) {
            // 创建文件
            System.out.println("创建 feign.client 文件夹" + file.mkdirs());
        }
    }

    /**
     * 生成存放 service 目录
     * @param projectPosition
     */
    public static void createService(ProjectPositionEntity projectPosition) {
        // 读取文件是否存在
        StringBuilder stringBuffer = new StringBuilder(obtainDocumentUrl(projectPosition));
        stringBuffer
                .append(projectPosition.getClientApplication())
                .append(projectPosition.getClientApplicationService());
        System.out.println("application.service 存放路径" + stringBuffer.toString());
        File file = new File(stringBuffer.toString());
        if (!file.exists() && !file.isDirectory()) {
            // 创建文件
            System.out.println("创建 application.service 文件夹" + file.mkdirs());
        }
    }

    /**
     * 生成存放 fallback 目录
     * @param projectPosition
     */
    public static void createFallback(ProjectPositionEntity projectPosition) {
        // 读取文件是否存在
        StringBuilder stringBuffer = new StringBuilder(obtainDocumentUrl(projectPosition));
        stringBuffer
                .append(projectPosition.getClientApplication())
                .append(projectPosition.getClientApplicationService())
                .append(projectPosition.getClientApplicationServiceFallback());
        System.out.println("application.fallback 存放路径" + stringBuffer.toString());
        File file = new File(stringBuffer.toString());
        if (!file.exists() && !file.isDirectory()) {
            // 创建文件
            System.out.println("创建 application.fallback 文件夹" + file.mkdirs());
        }
    }

    /**
     * 生成存放request 目录
     * @param projectPosition
     */
    public static void createUiRequest(ProjectPositionEntity projectPosition) {
        // 读取文件是否存在
        StringBuilder stringBuffer = new StringBuilder(obtainDocumentUrl(projectPosition));
        stringBuffer
                .append(projectPosition.getClientUi())
                .append(projectPosition.getClientUiRequest());
        System.out.println("request 存放路径" + stringBuffer.toString());
        File file = new File(stringBuffer.toString());
        if (!file.exists() && !file.isDirectory()) {
            // 创建文件
            System.out.println("创建request文件夹" + file.mkdirs());
        }
    }

    /**
     * 生成存放response 目录
     * @param projectPosition
     */
    public static void createUiResponse (ProjectPositionEntity projectPosition) {
        // 读取文件是否存在
        StringBuilder stringBuffer = new StringBuilder(obtainDocumentUrl(projectPosition));
        stringBuffer
                .append(projectPosition.getClientUi())
                .append(projectPosition.getClientUiResponse());
        System.out.println("response 存放路径" + stringBuffer.toString());
        File file = new File(stringBuffer.toString());
        if (!file.exists() && !file.isDirectory()) {
            // 创建文件
            System.out.println("创建response文件夹" + file.mkdirs());
        }
    }

    /**
     * 生成项目main和entity的目录
     * @param projectPosition
     */
    public static void createProject (ProjectPositionEntity projectPosition) {
        // 读取文件是否存在
        StringBuilder stringBuffer = new StringBuilder(obtainDocumentUrl(projectPosition));
        stringBuffer
                .append(projectPosition.getClientDomain())
                .append(projectPosition.getClientDomainRepository())
                .append(projectPosition.getClientDomainRepositoryEntity());

        System.out.println("entity 存放路径" + stringBuffer.toString());
        File file = new File(stringBuffer.toString());
        if (!file.exists() && !file.isDirectory()) {
            // 创建文件
            System.out.println("创建main文件夹" + file.mkdirs());
        }
    }

    /**
     * 生成项目model的目录
     * @param projectPosition
     */
    public static void createModel (ProjectPositionEntity projectPosition) {
        // 读取文件是否存在
        StringBuilder stringBuffer = new StringBuilder(obtainDocumentUrl(projectPosition));
        stringBuffer
                .append(projectPosition.getClientDomain())
                .append(projectPosition.getClientDomainModel());

        System.out.println("model 存放路径" + stringBuffer.toString());
        File file = new File(stringBuffer.toString());
        if (!file.exists() && !file.isDirectory()) {
            // 创建文件
            System.out.println("创建model文件夹" + file.mkdirs());
        }
    }

    /**
     * 生成项目Enums的目录
     * @param projectPosition
     */
    public static void createEnums (ProjectPositionEntity projectPosition) {
        // 读取文件是否存在
        StringBuilder stringBuffer = new StringBuilder(obtainDocumentUrl(projectPosition));
        stringBuffer
                .append(projectPosition.getClientDomain())
                .append(projectPosition.getClientDomainEnum());

        System.out.println("Enums 存放路径" + stringBuffer.toString());
        File file = new File(stringBuffer.toString());
        if (!file.exists() && !file.isDirectory()) {
            // 创建文件
            System.out.println("创建Enums文件夹" + file.mkdirs());
        }
    }

    /**
     * 生成项目resources 资源目录
     * @param projectPosition
     */
    public static void createResources (ProjectPositionEntity projectPosition) {
        String stringBuffer = projectPosition.getProjectPosition() +
                projectPosition.getProjectName() +
                projectPosition.getProjectSsrc() +
                projectPosition.getProjectMain() +
                projectPosition.getProjectResources();
        File file = new File(stringBuffer);
        if (!file.exists() && !file.isDirectory()) {
            // 创建resources文件
            System.out.println("创建resources文件夹" + file.mkdirs());
        }
    }


    /**
     * 生成项目test测试类目录
     * @param projectPosition
     */
    public static void createProjectTest (ProjectPositionEntity projectPosition) {
        String stringBuffer = projectPosition.getProjectPosition() +
                projectPosition.getProjectName() +
                projectPosition.getProjectSsrc() +
                projectPosition.getProjectTest() +
                projectPosition.getProjectTestJava();
        File file = new File(stringBuffer);
        if (!file.exists() && !file.isDirectory()) {
            // 创建test文件
            System.out.println("创建test文件夹" + file.mkdirs());
        }
    }

    /**
     * 获取存放entity路径路径
     * @param projectPosition
     * @return
     */
    public static String obtainEntityUrl (ProjectPositionEntity projectPosition) {
        String documentUrl = obtainDocumentUrl(projectPosition);
        return documentUrl +
                projectPosition.getClientDomain() +
                projectPosition.getClientDomainRepository() +
                projectPosition.getClientDomainRepositoryEntity();
    }

    /**
     * 获取存放Requester路径路径
     * @param projectPosition
     * @return
     */
    public static String obtainRequesterUrl (ProjectPositionEntity projectPosition) {
        String documentUrl = obtainDocumentUrl(projectPosition);
        return documentUrl +
                projectPosition.getClientUi() +
                projectPosition.getClientUiRequest();
    }

    /**
     * 获取存放query路径路径
     * @param projectPosition
     * @return
     */
    public static String obtainQueryUrl (ProjectPositionEntity projectPosition) {
        String documentUrl = obtainDocumentUrl(projectPosition);
        return documentUrl +
                projectPosition.getClientUi() +
                projectPosition.getClientUiRequest() +
                projectPosition.getClientUiRequestQuery();
    }

    /**
     * 获取存放response路径路径
     * @param projectPosition
     * @return
     */
    public static String obtainResponseUrl (ProjectPositionEntity projectPosition) {
        String documentUrl = obtainDocumentUrl(projectPosition);
        return documentUrl +
                projectPosition.getClientUi() +
                projectPosition.getClientUiResponse();
    }

    /**
     * 获取存放entity的Package
     * @param projectPosition
     * @return
     */
    public static String entityPackage (ProjectPositionEntity projectPosition) {
        String entityUrl = projectPosition.getProjectSubdomainName() +
                projectPosition.getProjectOneLevel() +
                projectPosition.getProjectTwoLevel() +
                projectPosition.getClient() +
                projectPosition.getClientDomain() +
                projectPosition.getClientDomainRepository();
                projectPosition.getClientDomainRepositoryEntity();

        String replace = entityUrl.replace("\\", ".");
        return replace.substring(0,replace.length()-1);
    }

    /**
     * 获取存放model路径路径
     * @param projectPosition
     * @return
     */
    public static String obtainModelUrl (ProjectPositionEntity projectPosition) {
        String documentUrl = obtainDocumentUrl(projectPosition);
        return documentUrl +
                projectPosition.getClientDomain() +
                projectPosition.getClientDomainModel();
    }

    /**
     * 获取存放Enums路径路径
     * @param projectPosition
     * @return
     */
    public static String obtainEnumsUrl (ProjectPositionEntity projectPosition) {
        String documentUrl = obtainDocumentUrl(projectPosition);
        return documentUrl +
                projectPosition.getClientDomain() +
                projectPosition.getClientDomainEnum();
    }

    /**
     * 获取存放Enums的Package
     * @param projectPosition
     * @return
     */
    public static String EnumsPackage (ProjectPositionEntity projectPosition) {
        String EnumsUrl = projectPosition.getProjectSubdomainName() +
                projectPosition.getProjectOneLevel() +
                projectPosition.getProjectTwoLevel() +
                projectPosition.getClient() +
                projectPosition.getClientDomain()+
                projectPosition.getClientDomainEnum();

        String replace = EnumsUrl.replace("\\", ".");
        return replace.substring(0,replace.length()-1);
    }

    /**
     * 获取存放model的Package
     * @param projectPosition
     * @return
     */
    public static String modelPackage (ProjectPositionEntity projectPosition) {
        String modelUrl = projectPosition.getProjectSubdomainName() +
                projectPosition.getProjectOneLevel() +
                projectPosition.getProjectTwoLevel() +
                projectPosition.getClient() +
                projectPosition.getClientDomain()+
                projectPosition.getClientDomainModel();

                String replace = modelUrl.replace("\\", ".");
        return replace.substring(0,replace.length()-1);
    }


    /**
     * 获取存放requester路径路径
     * @param projectPosition
     * @return
     */
    public static String requesterPackage (ProjectPositionEntity projectPosition) {
        String modelUrl = projectPosition.getProjectSubdomainName() +
                projectPosition.getProjectOneLevel() +
                projectPosition.getProjectTwoLevel() +
                projectPosition.getClient() +
                projectPosition.getClientUi() +
                projectPosition.getClientUiRequest();

        String replace = modelUrl.replace("\\", ".");
        return replace.substring(0,replace.length()-1);
    }

    /**
     * 获取存放requesterQuery路径路径
     * @param projectPosition
     * @return
     */
    public static String requesterQueryPackage (ProjectPositionEntity projectPosition) {
        String modelUrl = projectPosition.getProjectSubdomainName() +
                projectPosition.getProjectOneLevel() +
                projectPosition.getProjectTwoLevel() +
                projectPosition.getClient() +
                projectPosition.getClientUi() +
                projectPosition.getClientUiRequest() +
                projectPosition.getClientUiRequestQuery();

        String replace = modelUrl.replace("\\", ".");
        return replace.substring(0,replace.length()-1);
    }

    /**
     * 获取存放Response路径路径
     * @param projectPosition
     * @return
     */
    public static String responsePackage (ProjectPositionEntity projectPosition) {
        String modelUrl = projectPosition.getProjectSubdomainName() +
                projectPosition.getProjectOneLevel() +
                projectPosition.getProjectTwoLevel() +
                projectPosition.getClient() +
                projectPosition.getClientUi() +
                projectPosition.getClientUiResponse();

        String replace = modelUrl.replace("\\", ".");
        return replace.substring(0,replace.length()-1);
    }


    /**
     * 获取存放 client 路径路径
     * @param projectPosition
     * @return
     */
    public static String obtainClientUrl (ProjectPositionEntity projectPosition) {
        String documentUrl = obtainDocumentUrl(projectPosition);
        return documentUrl
                + projectPosition.getClientApplication()
                + projectPosition.getClientApplicationService()
                + projectPosition.getClientApplicationServiceClient();
    }

    /**
     * 获取存放 Client 的Package
     * @param projectPosition
     * @return
     */
    public static String clientPackage (ProjectPositionEntity projectPosition) {
        String modelUrl = projectPosition.getProjectSubdomainName() +
                projectPosition.getProjectOneLevel() +
                projectPosition.getProjectTwoLevel() +
                projectPosition.getClient() +
                projectPosition.getClientApplication() +
                projectPosition.getClientApplicationService() +
                projectPosition.getClientApplicationServiceClient();

        String replace = modelUrl.replace("\\", ".");
        return replace.substring(0,replace.length()-1);
    }



    /**
     * 获取存放 fallback 路径路径
     * @param projectPosition
     * @return
     */
    public static String obtainFallbackUrl (ProjectPositionEntity projectPosition) {
        String documentUrl = obtainDocumentUrl(projectPosition);
        return documentUrl
                + projectPosition.getClientApplication()
                + projectPosition.getClientApplicationService()
                + projectPosition.getClientApplicationServiceFallback();
    }

    /**
     * 获取存放 fallback 的Package
     * @param projectPosition
     * @return
     */
    public static String fallbackPackage (ProjectPositionEntity projectPosition) {
        String modelUrl = projectPosition.getProjectSubdomainName() +
                projectPosition.getProjectOneLevel() +
                projectPosition.getProjectTwoLevel() +
                projectPosition.getClient() +
                projectPosition.getClientApplication() +
                projectPosition.getClientApplicationService() +
                projectPosition.getClientApplicationServiceFallback();

        String replace = modelUrl.replace("\\", ".");
        return replace.substring(0,replace.length()-1);
    }

    /**
     * 获取存放 service 路径路径
     * @param projectPosition
     * @return
     */
    public static String obtainServiceUrl (ProjectPositionEntity projectPosition) {
        String documentUrl = obtainDocumentUrl(projectPosition);
        return documentUrl
                + projectPosition.getClientApplication();
    }

    /**
     * 获取存放 service 的Package
     * @param projectPosition
     * @return
     */
    public static String servicePackage (ProjectPositionEntity projectPosition) {
        String modelUrl = projectPosition.getProjectSubdomainName() +
                projectPosition.getProjectOneLevel() +
                projectPosition.getProjectTwoLevel() +
                projectPosition.getClient() +
                projectPosition.getClientApplication() +
                projectPosition.getClientApplicationService();

        String replace = modelUrl.replace("\\", ".");
        return replace.substring(0,replace.length()-1);
    }

    /**
     * 获取存放 Repositor 路径路径
     * @param projectPosition
     * @return
     */
    public static String obtainRepositoryUrl (ProjectPositionEntity projectPosition) {
        String documentUrl = obtainDocumentUrl(projectPosition);
        return documentUrl
                + projectPosition.getClientDomain()
                + projectPosition.getClientDomainRepository();
    }

    /**
     * 获取存放 Repositor 的Package
     * @param projectPosition
     * @return
     */
    public static String repositoryPackage (ProjectPositionEntity projectPosition) {
        String modelUrl = projectPosition.getProjectSubdomainName() +
                projectPosition.getProjectOneLevel() +
                projectPosition.getProjectTwoLevel() +
                projectPosition.getClient() +
                projectPosition.getClientDomain() +
                projectPosition.getClientDomainRepository();

        String replace = modelUrl.replace("\\", ".");
        return replace.substring(0,replace.length()-1);
    }

    /**
     * 获得存放client项目文件路径
     * @param projectPosition
     * @return
     */
    public static String obtainDocumentUrl (ProjectPositionEntity projectPosition) {
        return projectPosition.getProjectPosition() +
                projectPosition.getProjectName() +
                projectPosition.getProjectSsrc() +
                projectPosition.getProjectMain() +
                projectPosition.getProjectJava() +
                projectPosition.getProjectSubdomainName() +
                projectPosition.getProjectOneLevel() +
                projectPosition.getProjectTwoLevel()+
                projectPosition.getClient();
    }

    /**
     * 获得存放server项目文件路径
     * @param projectPosition
     * @return
     */
    public static String obtainServerDocumentUrl (ProjectPositionEntity projectPosition) {
        return projectPosition.getProjectPosition() +
                projectPosition.getProjectName() +
                projectPosition.getProjectSsrc() +
                projectPosition.getProjectMain() +
                projectPosition.getProjectJava() +
                projectPosition.getProjectSubdomainName() +
                projectPosition.getProjectOneLevel() +
                projectPosition.getProjectTwoLevel()+
                projectPosition.getServer();
    }

    /**
     * 获取存放 server.application.service.assembler 路径路径
     * @param projectPosition
     * @return
     */
    public static String obtainApplicationServiceAssemblerUrl (ProjectPositionEntity projectPosition) {
        String documentUrl = obtainServerDocumentUrl(projectPosition);
        return documentUrl
                + projectPosition.getServerApplication()
                + projectPosition.getServerApplicationService()
                + projectPosition.getServerApplicationServiceAssembler();
    }

    /**
     * 获取存放 server.application.service.assembler 的Package
     * @param projectPosition
     * @return
     */
    public static String applicationServiceAssemblerPackage (ProjectPositionEntity projectPosition) {
        String modelUrl = projectPosition.getProjectSubdomainName() +
                projectPosition.getProjectOneLevel() +
                projectPosition.getProjectTwoLevel() +
                projectPosition.getServer() +
                projectPosition.getServerApplication() +
                projectPosition.getServerApplicationService() +
                projectPosition.getServerApplicationServiceAssembler();

        String replace = modelUrl.replace("\\", ".");
        return replace.substring(0,replace.length()-1);
    }

    /**
     * 获取存放 server.application.service.desensitizer 路径路径
     * @param projectPosition
     * @return
     */
    public static String obtainApplicationServiceDesensitizerUrl (ProjectPositionEntity projectPosition) {
        String documentUrl = obtainServerDocumentUrl(projectPosition);
        return documentUrl
                + projectPosition.getServerApplication()
                + projectPosition.getServerApplicationService()
                + projectPosition.getServerApplicationServiceDesensitizer();
    }

    /**
     * 获取存放 server.application.service.desensitizer 的Package
     * @param projectPosition
     * @return
     */
    public static String applicationServiceDesensitizerPackage (ProjectPositionEntity projectPosition) {
        String modelUrl = projectPosition.getProjectSubdomainName() +
                projectPosition.getProjectOneLevel() +
                projectPosition.getProjectTwoLevel() +
                projectPosition.getServer() +
                projectPosition.getServerApplication() +
                projectPosition.getServerApplicationService() +
                projectPosition.getServerApplicationServiceDesensitizer();

        String replace = modelUrl.replace("\\", ".");
        return replace.substring(0,replace.length()-1);
    }

    /**
     * 获取存放 server.application.service.impl 路径路径
     * @param projectPosition
     * @return
     */
    public static String obtainApplicationServiceImplUrl (ProjectPositionEntity projectPosition) {
        String documentUrl = obtainServerDocumentUrl(projectPosition);
        return documentUrl
                + projectPosition.getServerApplication()
                + projectPosition.getServerApplicationService()
                + projectPosition.getServerApplicationServiceImpl();
    }

    /**
     * 获取存放 server.application.service.impl 的Package
     * @param projectPosition
     * @return
     */
    public static String applicationServiceImplPackage (ProjectPositionEntity projectPosition) {
        String modelUrl = projectPosition.getProjectSubdomainName() +
                projectPosition.getProjectOneLevel() +
                projectPosition.getProjectTwoLevel() +
                projectPosition.getServer() +
                projectPosition.getServerApplication() +
                projectPosition.getServerApplicationService() +
                projectPosition.getServerApplicationServiceImpl();

        String replace = modelUrl.replace("\\", ".");
        return replace.substring(0,replace.length()-1);
    }


    /**
     * 获取存放 server.domain.repository.dao 路径路径
     * @param projectPosition
     * @return
     */
    public static String obtainDomainRepositoryDaoUrl (ProjectPositionEntity projectPosition) {
        String documentUrl = obtainServerDocumentUrl(projectPosition);
        return documentUrl
                + projectPosition.getServerDomain()
                + projectPosition.getServerDomainRepository()
                + projectPosition.getServerDomainRepositoryDao();
    }

    /**
     * 获取存放 server.domain.repository.dao 的Package
     * @param projectPosition
     * @return
     */
    public static String domainRepositoryDaoPackage (ProjectPositionEntity projectPosition) {
        String modelUrl = projectPosition.getProjectSubdomainName() +
                projectPosition.getProjectOneLevel() +
                projectPosition.getProjectTwoLevel() +
                projectPosition.getServer() +
                projectPosition.getServerDomain() +
                projectPosition.getServerDomainRepository() +
                projectPosition.getServerDomainRepositoryDao();

        String replace = modelUrl.replace("\\", ".");
        return replace.substring(0,replace.length()-1);
    }

    /**
     * 获取存放 server.domain.repository.impl 路径路径
     * @param projectPosition
     * @return
     */
    public static String obtainDomainRepositoryImplUrl (ProjectPositionEntity projectPosition) {
        String documentUrl = obtainServerDocumentUrl(projectPosition);
        return documentUrl
                + projectPosition.getServerDomain()
                + projectPosition.getServerDomainRepository()
                + projectPosition.getServerDomainRepositoryImpl();
    }

    /**
     * 获取存放 server.domain.repository.impl 的Package
     * @param projectPosition
     * @return
     */
    public static String domainRepositoryImplPackage (ProjectPositionEntity projectPosition) {
        String modelUrl = projectPosition.getProjectSubdomainName() +
                projectPosition.getProjectOneLevel() +
                projectPosition.getProjectTwoLevel() +
                projectPosition.getServer() +
                projectPosition.getServerDomain() +
                projectPosition.getServerDomainRepository() +
                projectPosition.getServerDomainRepositoryImpl();

        String replace = modelUrl.replace("\\", ".");
        return replace.substring(0,replace.length()-1);
    }

    /**
     * 获取存放 server.domain.repository.translator 路径路径
     * @param projectPosition
     * @return
     */
    public static String obtainDomainRepositoryTranslatorlUrl (ProjectPositionEntity projectPosition) {
        String documentUrl = obtainServerDocumentUrl(projectPosition);
        return documentUrl
                + projectPosition.getServerDomain()
                + projectPosition.getServerDomainRepository()
                + projectPosition.getServerDomainRepositoryTranslator();
    }

    /**
     * 获取存放 server.domain.repository.translator 的Package
     * @param projectPosition
     * @return
     */
    public static String domainRepositoryTranslatorPackage (ProjectPositionEntity projectPosition) {
        String modelUrl = projectPosition.getProjectSubdomainName() +
                projectPosition.getProjectOneLevel() +
                projectPosition.getProjectTwoLevel() +
                projectPosition.getServer() +
                projectPosition.getServerDomain() +
                projectPosition.getServerDomainRepository() +
                projectPosition.getServerDomainRepositoryTranslator();

        String replace = modelUrl.replace("\\", ".");
        return replace.substring(0,replace.length()-1);
    }
}
